#pragma once
#include<WinSock2.h>
#include<memory>
#include"net.h"
#include"comLib\global.h"

class COM_API CNet
{
public:
	enum NetType {
		SERVER,
		CLIENT
	};
public:
	CNet(NetType);
	~CNet();
	void sendBuf(const char *buf, int size);
	std::shared_ptr<char> recvBuf(int size);
	int recvInt(int &iData);
	int sendInt(const int iData);
	int sendPacket(char *pData, int dataSize);
	int recvPacket();
	

private:
	int initTcpClient();
	int initTcpServer();

private:
	SOCKET m_pSocket;
	SOCKET m_clientSocket;
};

